package com.hsc.mvc.handler;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.lang.reflect.Method;

/**
 * @author
 * @date 2025-06-10
 * @Description 使用策略模式实现响应处理
 * 策略模式接口
 */
public interface ResponseHandleStrategy {
    /**
     * 判断当前响应结果是否该处理器
     * @param result
     * @param targetMethod
     * @return
     */
    boolean isSupport(Object result , Method targetMethod);

    /**
     * 处理响应结果
     * @param result
     * @param targetMethod
     * @param request
     * @param response
     * @throws ServletException
     * @throws IOException
     */
    void handle(Object result , Method targetMethod, HttpServletRequest request , HttpServletResponse response) throws ServletException, IOException;

}
